﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using ProgrammerToolsKits.Comic.Interface;

namespace ProgrammerToolsKits.Comic.Modal
{
    public class ComicDownloadTask : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private int _Count;
        public int Count {
            get => _Count;
            private set {
                _Count = value;
                PropertyChanged?.Invoke( this, new PropertyChangedEventArgs( nameof( Count ) ) );
            }
        }


        private double _Progress;
        public double Progress {
            get => _Progress;
            internal set {
                _Progress = value;
                PropertyChanged?.Invoke( this, new PropertyChangedEventArgs( nameof( Progress ) ) );
            }
        }

        public string TaskName { get;private set; }

        public readonly IReadOnlyList<IComicPage> Pages;
        public readonly IComicVolume Volume;
        public readonly IComicBook Book;

        public ComicDownloadTask(IComicBook book,IComicVolume volume,IReadOnlyList<IComicPage> pages)
        {
            Pages = pages;
            Book = book;
            Volume = volume;
            TaskName = volume.Title;
            Count = pages.Count;
        }
    }
}
